<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <title>Document</title>
  <style>
    
  </style>
</head>
<body>
  <div class="box" title="这是title" abc="123">
    <span>这是span</span>
    hello
    <!-- 这是注释 -->
    <span>2</span>
    <!-- 这还是注释 -->
    <!-- abc -->
    <!-- qwe -->

  </div>
</body>
<script>

  var box = document.querySelector(".box");

  var childs = box.childNodes;
  var attrs = box.attributes;

  console.log( childs[1] );
  console.log( childs[1].nodeType );
  console.log( childs[1].nodeName );
  console.log( childs[1].nodeValue );
  console.log( attrs[0] );
  console.log( attrs[0].nodeType );
  console.log( attrs[0].nodeName );
  console.log( attrs[0].nodeValue );
  console.log( childs[2] );
  console.log( childs[2].nodeType );
  console.log( childs[2].nodeName );
  console.log( childs[2].nodeValue );
  console.log( childs[3] );
  console.log( childs[3].nodeType );
  console.log( childs[3].nodeName );
  console.log( childs[3].nodeValue );
  console.log( document );
  console.log( document.nodeType );
  console.log( document.nodeName );
  console.log( document.nodeValue );

  console.log("-=-=---")

  for(var i=0;i<childs.length;i++){
    if(childs[i].nodeType === 8){
      console.log(childs[i]);
    }
  }
</script>
</html>